When you detect an error or invalid state in a function, what's the best way to handle it?
优雅的退出 当你在函数中检测到一个错误或者无效状态时,最好的处理方式是什么呢? 返回一个错误代号(error code),抛出一个异常还是调用assert()?
Thus, it is possible to rapidly and accurately detect an error of the linear motion device.
由此,能够尽早并且以高精度对直动装置的异常进行检测。
Also, the test in Line 13 will fail to detect an error because the result of the call will not be an empty string.
第13行中的检查也无法探测到错误,因为调用的结果不是空字符串。
应用推荐